﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace StyleMVVM.DependencyInjection
{
	/// <summary>
	/// This delegate is used to allow for an objects cleanup for it is disposed
	/// </summary>
	/// <param name="objectBeingDisposed"></param>
	public delegate void BeforeDisposalCleanupDelegate(object objectBeingDisposed);

	/// <summary>
	/// IDisposalScope represents an object that holds a set of object for disposing
	/// </summary>
	public interface IDisposalScope : IDisposable
	{
		/// <summary>
		/// Add an object to be disposed when the scope is done
		/// </summary>
		/// <param name="newObject"></param>
		void AddObject(IDisposable newObject);

		/// <summary>
		/// Add an object to be disposed when the scope is done, it takes a delegate to be called before disposal happens
		/// </summary>
		/// <param name="newObject"></param>
		/// <param name="cleanupDelegate"></param>
		void AddObject(IDisposable newObject, BeforeDisposalCleanupDelegate cleanupDelegate);
	}
}
